1
//--------------------------------------------------------------------------
3 // Copyright (c) Microsoft Corporation. All rights reserved.
5 // File: PizzaSizeCircle.xaml.cs
7 //--------------------------------------------------------------------------
11 using System
.Windows
.Controls
;
16 /// Interaction logic for PizzaSizeCircle.xaml
18 public partial class PizzaSizeCircle
: UserControl
21 public PizzaSizeCircle()
23 InitializeComponent();
30 return (int)this.GetValue(PizzaSizeProperty
);
34 this.SetValue(PizzaSizeProperty
, value);
39 static void PizzaSizeChangedCallBack(DependencyObject property
, DependencyPropertyChangedEventArgs args
)
41 var control
= (PizzaSizeCircle
)property
;
42 switch ((int)args
.NewValue
)
45 control
.circle
.Width
= 30;
46 control
.circle
.Height
= 30;
47 control
.layoutRoot
.Width
= 30;
48 control
.layoutRoot
.Height
= 30;
49 control
.label
.Text
= "11";
52 control
.circle
.Width
= 50;
53 control
.circle
.Height
= 50;
54 control
.layoutRoot
.Width
= 50;
55 control
.layoutRoot
.Height
= 50;
56 control
.label
.Text
= "13";
59 control
.circle
.Width
= 75;
60 control
.circle
.Height
= 75;
61 control
.layoutRoot
.Width
= 75;
62 control
.layoutRoot
.Height
= 75;
63 control
.label
.Text
= "17";
66 throw new ArgumentOutOfRangeException();
70 public static readonly DependencyProperty PizzaSizeProperty
=
71 DependencyProperty
.Register("PizzaSize", typeof(int), typeof(PizzaSizeCircle
),
72 new UIPropertyMetadata(17, new PropertyChangedCallback(PizzaSizeChangedCallBack
)));